package com.cirkana;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.io.IOException;
import java.util.Date;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class TestUtils {

	public static final String testString = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi eu tortor vel neque congue congue. Mauris quis erat. Vestibulum dictum ligula vel purus. Vivamus eget purus. Quisque nulla. Proin nonummy elit nec erat. Suspendisse molestie, orci sed molestie congue, erat pede consectetuer tellus, non ultricies turpis purus eget lorem. Fusce ut libero. Donec gravida euismod elit. Sed rhoncus. Vivamus nibh magna, scelerisque id, tempus in, auctor non, ipsum. Vivamus vitae metus id elit consectetuer vestibulum. Etiam augue. Ut velit urna, porta a, commodo vitae, blandit vitae, odio. Ut mi arcu, placerat eu, imperdiet non, molestie quis, elit. Phasellus ligula ipsum, venenatis sit amet, feugiat eget, blandit aliquam, risus. Donec mollis.";
	public static final Double testDoublePositive = 7834834342342.704958340547395557534023098752405986456454d;
	public static final Double testDoubleNegative = -12960569.473453956050686040576d;
	public static final Float testFloatPositive = 78348343423289472938749823342.70495834054739555230947820348029384092347534023098752405986456454f;
	public static final Float testFloatNegative = -129629017832017489358469.47345395605068604055986450890292329382932323387423402376f;
	public static final Date testDatePast = DateUtil.getDate(1941, 5, 31, 21,
			7, 46);
	public static final Date testDateFuture = DateUtil.getDate(2087, 12, 25, 3,
			59, 59);
	public static final Date testDateActual = DateUtil.getDate(2011, 5, 12, 13,
			2, 37);

	public static void assertArrayEquals(Object[] expected, Object[] actual) {
		if (expected == null && actual == null)
			return;
		assertNotNull(expected);
		assertNotNull(actual);
		assertEquals(expected.length, actual.length);
		for (int iii = 0; iii < expected.length; iii++)
			assertEquals(expected[iii], actual[iii]);
	}

	public static Bitmap getBitmap(String imageFileName) throws IOException {
		return BitmapFactory.decodeFile(imageFileName);
		// File imageFile = new File(imageFileName);
		// BufferedImage bufferedImage = ImageIO.read(imageFile);
		// int[] pixels = new int[bufferedImage.getWidth()
		// * bufferedImage.getHeight()];
		// bufferedImage.getRGB(0, 0, bufferedImage.getWidth(), bufferedImage
		// .getHeight(), pixels, 0, bufferedImage.getWidth());
		// byte[] data = new byte[pixels.length];
		// for (int iii = 0; iii < pixels.length; iii++)
		// data[iii] = (byte)pixels[iii];
		//
		// BitmapFactory.Options o = new BitmapFactory.Options();
		// o.outWidth = bufferedImage.getWidth();
		// o.outHeight = bufferedImage.getHeight();
		// Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, pixels.length,
		// o);
		// // Bitmap bitmap = Bitmap.createBitmap(pixels,
		// bufferedImage.getWidth(),
		// // bufferedImage.getHeight(), Bitmap.Config.RGB_565);
		// return bitmap;
	}
}
